export function findBottomLeftValue(root: TreeNode | null): number {
    if (!root) return NaN;
    let res = 0
    const nodeArr:TreeNode[]=[root] 
    while (nodeArr.length) {
       const len = nodeArr.length 
       for (let index = 0; index < len; index++) {
         const node = nodeArr.shift() 
         if(index===0) res=node.val
         if(node.left) nodeArr.push(node.left)
         if(node.right) nodeArr.push(node.right)
       }
    }
    return res
};